﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Table_Dal;
using DAL;
namespace BLL
{
    public class ChuongBll
    {
        public List<ChuongTbl> DSChuong_MaMon(string MaMon)
        {
            ChuongDal chuong = new ChuongDal();
            
            return chuong.DSChuong_Mon(MaMon);
        }
        
        public bool SuaCauhoi(ChuongTbl chg)
        {
            ChuongDal chuong = new ChuongDal();
            return chuong.SuaChuong(chg);
        }
        public bool ThemChuong(string TenChuong,string mamon)
        {
            BusinessLogicLayer bll =new BusinessLogicLayer();
            ChuongDal dal = new ChuongDal();
            string ma = bll.RandomMa();
            while (dal.KiemTra_TrungKhoa(ma) == true)
            {
                ma = bll.RandomMa();
            }
            ChuongTbl chg = new ChuongTbl();
            chg.MaChuong = ma;
            chg.TenChuong = TenChuong;
            chg.MaMonHoc = mamon;
            
            return dal.ThemChuong(chg);
        }
        public bool XoaChuong(string MaChuong)
        {
            
            ChuongDal chg = new ChuongDal();
            chg.XoaChuong(MaChuong);
            return true;
        }
        public bool KiemTra_TrungKhoa(string ma)
        {
            ChuongDal chg = new ChuongDal();
            return chg.KiemTra_TrungKhoa(ma);
        }

        public List<string> LayTatCa_string()
        {
            ChuongDal chg = new ChuongDal();
            return chg.LayTatCa_string();
        }
    }
}
